package com.lanou3g.code0410;

/**
 * Created by dllo on 18/4/10.
 */

// 多态
public class Test02 {
    public static void main(String[] args) {
        // 父类引用 指向子类对象
        //    ------多态
        Animal animal0 = new Animal();
        Animal animal1 = new Cat();

        Animal animal2 = new Dog();
        Dog dog = (Dog) animal2; // 向下转型
        dog.lookDoor();

        Animal animal3 = new Garfield();

        Zoo zoo = new Zoo();
        zoo.feed(animal0);
        zoo.feed(animal1);
        zoo.feed(animal2);
        zoo.feed(animal3);
    }
}
